import { EnvType } from "@lgq/config";
import cloudRequest from "@lgq/utils/cloudRequest";
import { json } from "stream/consumers";


export const createBook = async () => {
    cloudRequest.app
        .callFunction({
            "name": "book-manager",
            "data": {
                "action": "createBook",
                "data": {
                    "title": "三体"
                }
            }
        })
        .then((res) => {
            console.log('创建成功：', res);
        }).catch((e) => {
            console.log(e);
        });
}

export const search = async () => {
    const collection = await cloudRequest.models.table_book.list({
        filter: {
            where: {
                _id: {
                    $in: ["BUEGEBEGW4","BUEGGC6TX6"] , // 推荐传入_id数据标识进行操作
                },
            },
        },
        envType: EnvType
    });
    console.log(JSON.stringify(collection));
}